"""
@author: mark
@contact: QQ:1241642375
@Created on: 2024年8月19日16:59:28
@Remark: 视图层
"""
from django.shortcuts import render

# Create your views here.
from challenges.models import (ChallengeItem, DeptChallenge)
from challenges.serializers import ChallengeItemSerializer, ChallengeItemCreateUpdateSerializer, DeptChallengeSerializer, DeptChallengeCreateUpdateSerializer
from dvadmin.utils.viewset import CustomModelViewSet


class ChallengeItemViewSet(CustomModelViewSet):
    """
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """
    queryset = ChallengeItem.objects.all()
    serializer_class = ChallengeItemSerializer
    create_serializer_class = ChallengeItemCreateUpdateSerializer
    update_serializer_class = ChallengeItemCreateUpdateSerializer


class DeptChallengeViewSet(CustomModelViewSet):
    """
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """
    queryset = DeptChallenge.objects.all()
    serializer_class = DeptChallengeSerializer
    create_serializer_class = DeptChallengeCreateUpdateSerializer
    update_serializer_class = DeptChallengeCreateUpdateSerializer